Skip to content

Report no columns for Thrift statements without output - #651

Merged
vuanhphung merged 6 commits into
mainfrom
fix/thrift-ddl-empty-schema
Dec 2, 2026
Merged

vuanhphung merged 6 commits into
mainfrom
fix/thrift-ddl-empty-schema

Conversation

@vuanhphung

@vuanhphung vuanhphung commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #309. Thrift getSchema() and getResultMetadata().schema now return { columns: [] } for statements without output columns when Arrow metadata confirms there are no fields, matching kernel behavior. This replaces the Result STRING placeholder, so callers must check columns.length before indexing. An empty SELECT retains its actual columns.

The deprecated getMetadata() preserves the Thrift wire response, and responses without Arrow metadata retain the placeholder. Also fixes the existing column-based fetch loop when the schema is empty or missing, with a separate changelog note and operation-level regression coverage.

Validation: 119 focused unit tests, type checking, lint, and formatting passed. All eight hang regressions also fail promptly with the old hasMore() behavior. The live E2E test now checks metadata before and after fetching, including preservation of the legacy placeholder; those expanded assertions await CI.

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

✅ No issues identified.

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

✅ No issues identified.

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

✅ No issues identified.

vuanhphung and others added 4 commits December 1, 2026 16:56
For DDL the Thrift server sends a placeholder `Result STRING` column, which
can't be told apart from `SELECT 'x' AS Result WHERE 1 = 0`. The Arrow schema
in the same response has no fields, so getSchema() and getResultMetadata()
now report no columns, matching the kernel backend. getMetadata() still
returns the wire response. Without Arrow results the wire is identical and
the placeholder is kept.

Fixes #309

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Decode the Arrow schema once per operation and hand the normalized
metadata to the result handlers, so DDL results skip FetchResults.
getSchema() goes through an optional IOperationBackend.getSchema()
instead of an instanceof check and still works without resultFormat.
Tolerate Thrift schemas missing required fields, close operations and
the session even when e2e assertions fail, and add a changelog entry.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

✅ No issues identified.

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Nit

Looks good, no blocking issues. Raw metadata is kept for getMetadata(), and the normalized copy feeds getSchema(), getResultMetadata(), the result handlers and telemetry. The placeholder check is narrow, and both the prefetched and fetched metadata paths have unit tests.

Other findings

  • ⚪ Nit — The JsonResultHandler.hasMore() empty-schema guard is not reached by the new Arrow normalization, because column-based results keep the server's placeholder schema. It only changes behavior when the schema is missing or empty, and the CHANGELOG doesn't mention it. Add a CHANGELOG line or a PR note. (Found by Claude Opus 5.5 · confirmed by the judge)

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

✅ No issues identified.

@vuanhphung
vuanhphung added this pull request to the merge queue Dec 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Dec 1, 2026
@vuanhphung
vuanhphung added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit c9a051d Dec 2, 2026
22 of 23 checks passed
@vuanhphung
vuanhphung deleted the fix/thrift-ddl-empty-schema branch December 2, 2026 03:20
cathleeny added a commit that referenced this pull request Dec 3, 2026
Brings in the kernel SOCKS proxy routing (#653) and #651. KERNEL_REV now pins kernel 159a2ff0b69d, which carries both SOCKS and the External header-provider bridge, and native/kernel/index.d.ts matches a binding built from it. CONNECTION_PARAMETERS.md keeps both features' notes.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>

Co-authored-by: Isaac <no-reply@databricks.com>

This branch was previously deployed

1 inactive deployment
azure-prod — 2b3a3cbc Deployed Dec 1, 2026 by vuanhphung via e2e-test (22.23.4, 22_23_4) #2265
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DDL Statement vs Select statement identical results

2 participants